USE Lib
GO

---------------------------------------------------------------------------
-- BEGIN MAINTENANCE WRAPPER
----------------------------
IF EXISTS (SELECT * FROM sysobjects WHERE type = 'FN' AND name = '{your_function_name}') BEGIN
	DROP  FUNCTION  tsql.{your_function_name}
	PRINT '<<< DROP FUNCTION tsql.{your_function_name} - Completed with SUCCESS >>>'
END

GO
----------------------------
-- END MAINTENANCE WRAPPER
---------------------------------------------------------------------------

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


/*================================================================================================
Name:			tsql.{your_function_name}
Type:			User defined function 
Owner:					
Description:	Counts the number of occurences of a string whitin an other
Parameters:		@my_param1 = function first parameter
				@my_paramN = function Nth parameter
Dependens on:  	none
Usage:			
--------------------------------------------------------------------------------------------------
Project:		http://sqllib.codeplex.com/
Help:			http://sqllib.codeplex.com/wikipage?title={your_function_name}		
Version:		YYYYMMDD
SrcCtrlApp:		SVN
SrcCtrlPath:	http://sqllib.codeplex.com/SourceControl/list/changesets
Note*:			CTRL + click on the link above to load the page
--------------------------------------------------------------------------------------------------
History:		MM/DD/YYYY - {developers_name} - Function created
================================================================================================*/

CREATE FUNCTION tsql.{your_function_name} 
	(@my_param1 AS NVARCHAR(MAX)
	,@my_paramN NVARCHAR(MAX))
RETURNS BIGINT 
AS 
	BEGIN 
		RETURN 0
	END
GO

---------------------------------------------------------------------------
-- BEGIN MAINTENANCE WRAPPER
-- Verify completion
----------------------------
IF EXISTS(SELECT * FROM sysobjects WHERE type = 'FN' AND name = '{your_function_name}') BEGIN 
	PRINT '<<< CREATE FUNCTION tsql.{your_function_name} - Completed with SUCCESS >>>'
END

ELSE BEGIN 
	PRINT '<<< CREATE FUNCTION tsql.{your_function_name} - Completed with ERROR >>>'
END


GO
----------------------------
-- END MAINTENANCE WRAPPER
---------------------------------------------------------------------------

--  GRANT SELECT TO PUBLIC will be used at Db level
